package com.starnet.yarnmonitor.security.controller;

import com.starnet.yarnmonitor.security.mapper.SysUserMapper;
import com.starnet.yarnmonitor.security.service.SysUserService;
import com.starnet.yarnmonitor.security.vo.param.AddUserParam;
import com.starnet.yarnmonitor.security.vo.param.LoginParam;
import com.starnet.yarnmonitor.security.vo.param.ModifyPasswordParam;
import com.starnet.yarnmonitor.yarn.vo.result.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    SysUserService sysUserService;

    @PostMapping("/add")
    public Result addUser(@RequestBody @Valid AddUserParam addUserParam) {
        sysUserService.addUser(addUserParam);
        return Result.success("添加成功");
    }

    @PutMapping("/password")
    public Result modifyPassword(@RequestBody @Valid ModifyPasswordParam modifyPasswordParam){
        sysUserService.modifyPassword(modifyPasswordParam);
        return Result.success("修改成功");
    }


}
